package hotgammon.view.tools;

import hotgammon.domain.Game;
import hotgammon.view.*;
import hotgammon.view.figures.*;

import java.awt.event.MouseEvent;

import minidraw.framework.*;
import minidraw.standard.*;

public class DieRollTool extends NullTool {
	
	private BackgammonUserInterface objectServer;
	
	public DieRollTool(BackgammonUserInterface ui) {
	    this.objectServer = ui;
	}
	
	public void mouseDown(MouseEvent e, int x, int y) {
	    Figure f = objectServer.getEditor().drawing().
	      findFigure(e.getX(), e.getY());
	    if (f instanceof DieFigure) {
	    	Game g = objectServer.getGame();
	    	g.nextTurn();
	    }
	}
}
